package com.yuan.farmerwork.ynblog.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yuan.farmerwork.ynblog.domain.YnLinks;
import com.yuan.farmerwork.ynblog.service.YnLinksService;
import com.yuan.farmerwork.ynblog.utils.constants.CommConstants;
import com.yuan.farmerwork.ynblog.utils.constants.PageConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * 友情链接页面.
 *
 * @author yjs
 * @date 2021/1/14 15:47
 */
@Controller
public class UselinkController {

    @Autowired
    private YnLinksService ynLinksService;

    /**
     * 友情链接页面.
     *
     * @param map 页面参数map
     * @return
     */
    @GetMapping("/uselink")
    public ModelAndView useLink(Map map) {
        List<YnLinks> ynLinks =
                ynLinksService.list(new QueryWrapper<YnLinks>()
                        .eq(CommConstants.MYBATIS_SQL_FIELD_IS_DELELTE, 0));
        map.put(PageConstants.PAGE_PARAM_YN_LINKS, ynLinks);
        return new ModelAndView(PageConstants.PAGE_USE_LINK, map);
    }

}
